import App from '../App'

const home = r => require.ensure([], () => r(require('../page/home/home')),
  'home')

const shop = r => require.ensure([], () => r(require('../page/shop/shop')),
  'shop')

const login = r => require.ensure([], () => r(require('../page/login/login')),
  'login')

const about = r => require.ensure([], () => r(require('../page/about/about')),
  'about')

const confirmOrder = r => require.ensure([], () => r(require(
  '../page/confirmOrder/confirmOrder')), 'confirmOrder')

const remark = r => require.ensure([], () => r(require(
  '../page/confirmOrder/children/remark')), 'remark')


const order = r => require.ensure([], () => r(require(
  '../page/order/order')), 'order')


export default [{
  path: '/',
  component: App, //顶层路由，对应index.html
  children: [ //二级路由。对应App.vue
    //
    {
      path: '',
      redirect: '/home'
    },
    //首页城市列表页
    {
      path: '/home',
      component: home
    },
    //登录注册页
    {
      path: '/login',
      component: login
    },
    //我的
    {
      path: '/about',
      component: about
    },
    //选菜
    {
      path: '/shop/:id',
      component: shop
    },
    //确认订单页
    {
      path: '/confirmOrder',
      component: confirmOrder,
      children: [{
        path: 'remark', //订单备注
        component: remark,
      }]
    },
    //订单列表
    {
      path: '/order',
      component: order
    }
  ]
}]
